package tdt4240.iddqd;

import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;

import tdt4240.iddqd.sprites.Enemy;

public class EnemyFactory {

	private static TiledTextureRegion mDefaultEnemyImage = GameActivity.mEnemyWalk;

	/**
	 * Create a enemy instance based on a position and a type
	 * @param dx X position of desired enemy
	 * @param dy Y position of desired enemy
	 * @param type Type-string of desired enemy
	 * @return A enemy instance
	 */
	public static Enemy createEnemy(int dx, int dy, String type){
		Enemy enemy;

		if(type.equals(Constants.ENEMY_SIMPLE)){ // Simple
			enemy = new Enemy(dx, dy, mDefaultEnemyImage.deepCopy()); 
			enemy.setScale(Constants.SCALE_ENEMY_SIMPLE);
		}
		else if(type.equals(Constants.ENEMY_MEDIUM)){ // Medium
			enemy = new Enemy(dx, dy, mDefaultEnemyImage.deepCopy()); 
			enemy.health=40;
			enemy.damage=25;
			enemy.speed = 100;
			enemy.setScale(Constants.SCALE_ENEMY_MEDIUM);
		}
		else if(type.equals(Constants.ENEMY_BOSS)){ // Boss
			enemy = new Enemy(dx, dy, mDefaultEnemyImage.deepCopy());
			enemy.health = 100;
			enemy.damage = 50;
			enemy.speed = 100;
			enemy.setScale(Constants.SCALE_ENEMY_BOSS);
		}
		else{
			enemy = new Enemy(dx, dy, mDefaultEnemyImage.deepCopy());
		}

		return enemy;
	}
}
